package org.sfnelson.sk.server;

import javax.jdo.PersistenceManager;

import org.sfnelson.sk.client.data.User;
import org.sfnelson.sk.client.rpc.AdminService;
import org.sfnelson.sk.client.rpc.Event;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class AdminServiceImpl extends RemoteServiceServlet implements AdminService {

	private static final long serialVersionUID = -4579568148462375679L;

	public void clearAll() {
		PersistenceManager pm = PMF.getPersistenceManager();

		try {
			pm.newQuery(User.class).deletePersistentAll();
			pm.newQuery(Event.class).deletePersistentAll();
		} finally {
			pm.close();
		}
	}

}
